﻿@model WalkingTec.Mvvm.Mvc.Admin.ViewModels.FrameworkMenuVMs.FrameworkMenuVM

<wt:form vm="@Model">
    <wt:tab>
        <wt:tabheaders>
            <wt:tabheader title="菜单信息" />
            <wt:tabheader title="权限设置" />
        </wt:tabheaders>
        <wt:tabcontents>
            <wt:tabcontent>
                <wt:row items-per-row=" ItemsPerRowEnum.Two">
                    <wt:radio field="Entity.IsInside" yes-text="内部" no-text="外部" change-func="MenuTypeChange(data)" />
                </wt:row>
                <wt:row items-per-row="ItemsPerRowEnum.Two" id="modelrow">
                    <wt:combobox field="Entity.ModuleId" items="AllModules" link-field="Entity.ActionId" trigger-url="/_Admin/FrameworkMenu/GetActionsByModelId" enable-search="true" />
                    <wt:combobox field="Entity.ActionId" items="AllActions" />
                </wt:row>
                <wt:row id="urlrow">
                    <wt:textbox field="Entity.Url" />
                </wt:row>
                <wt:row items-per-row="ItemsPerRowEnum.Two">
                    <wt:textbox field="Entity.PageName" />
                    <wt:combobox field="Entity.ParentId" items="AllParents" />
                </wt:row>
                <wt:row items-per-row="ItemsPerRowEnum.Two">
                    <wt:textbox field="Entity.DisplayOrder" />
                    <wt:upload field="Entity.IConId" upload-type="ImageFile" />
                </wt:row>
                <wt:row items-per-row="ItemsPerRowEnum.Four">
                    <wt:switch field="Entity.ShowOnMenu" lay-text="是|否" />
                    <wt:switch field="Entity.FolderOnly" lay-text="是|否" />
                    <wt:switch field="Entity.IsPublic" lay-text="是|否" />
                </wt:row>
                <div style="height:100px"></div>
            </wt:tabcontent>
            <wt:tabcontent>
                <wt:selector list-vm="RoleListVM" field="SelectedRolesIDs" text-bind="RoleListVM.EntityList[0].RoleName">
                    <wt:searchpanel vm="RoleListVM">
                        <wt:row items-per-row=" ItemsPerRowEnum.Two">
                            <wt:textbox field="RoleListVM.Searcher.RoleCode" />
                            <wt:textbox field="RoleListVM.Searcher.RoleName" />
                        </wt:row>
                    </wt:searchpanel>
                </wt:selector>
                <wt:selector list-vm="RoleListVM" field="SelectedRolesID2" text-bind="RoleListVM.EntityList[0].RoleName">
                    <wt:searchpanel vm="RoleListVM">
                        <wt:row items-per-row=" ItemsPerRowEnum.Two">
                            <wt:textbox field="RoleListVM.Searcher.RoleCode" />
                            <wt:textbox field="RoleListVM.Searcher.RoleName" />
                        </wt:row>
                    </wt:searchpanel>
                </wt:selector>
                <wt:selector list-vm="UserListVM" field="SelectedUsersID" text-bind="UserListVM.EntityList[0].Name">
                    <wt:searchpanel vm="UserListVM">
                        <wt:row items-per-row=" ItemsPerRowEnum.Two">
                            <wt:textbox field="UserListVM.Searcher.ITCode" />
                            <wt:textbox field="UserListVM.Searcher.Name" />
                        </wt:row>
                    </wt:searchpanel>
                </wt:selector>
                <wt:selector list-vm="UserListVM" field="SelectedUsersID2" text-bind="UserListVM.EntityList[0].Name">
                    <wt:searchpanel vm="UserListVM">
                        <wt:row items-per-row=" ItemsPerRowEnum.Two">
                            <wt:textbox field="UserListVM.Searcher.ITCode" />
                            <wt:textbox field="UserListVM.Searcher.Name" />
                        </wt:row>
                    </wt:searchpanel>
                </wt:selector>
            </wt:tabcontent>
        </wt:tabcontents>
    </wt:tab>
    <wt:row align="AlignEnum.Right">
        <wt:submitbutton />
        <wt:closebutton />
    </wt:row>
</wt:form>
<script>
    DoMenuTypeChange('@Model.Entity.IsInside.ToString().ToLower()');
    function MenuTypeChange(data) {
        DoMenuTypeChange(data.value);
    }
    function DoMenuTypeChange(inside) {
        var url = $('#urlrow');
        var model = $('#modelrow');
        if (inside == "true") {
            url.css('display', 'none');
            model.css('display', 'block');
        }
        else {
            url.css('display', 'block');
            model.css('display', 'none');

        }

    }
</script>